﻿@using GigaSite.Web.Controllers
@model GigaSite.Web.Areas.Catalog.Models.AdsListItemModel
@{
    var currentUser = ViewContext.GetBaseController().CurrentUser;
    bool advInFave = currentUser != null && currentUser.AdsInFavourites(Model.Id);
}
<div class="ads" data-id="@Model.Id" data-imageUrl="@Model.ImageURI">
    <a href="@Url.Action("ViewAds",new {id = Model.Id})">
        <div class="adsImage">
            <img src="@Model.ThumbImageURI" width="260" height="130"/>
        </div>
    </a>
    <div class="adsBackground">
        <div class="adsTitle">
            @Html.ActionLink(Model.Title,"ViewAds",new {id = Model.Id})
        </div>
        <div class="adsFooter">
            <div class="adsViewsCount">
                @Model.Views просмотров
            </div>
            <div class="adsButtons">
                @if (Model.Price.HasValue)
                {
                    <div class="adsPrice">
                        @Model.Price.Value Р
                    </div>
                }
                @if(!Model.ImageURI.Contains("adsNoImage"))
                {
                    <span class="zoomAdv">
                    
                    </span>
                }
                @if (currentUser != null && Model.Author.Id != currentUser.Id)
                {
                    <span class="addFave" style="display: @(advInFave ? "none": "inline-block")" title="Добавить в избранное">&nbsp;</span>
                    <span class="removeFave" style="display: @(advInFave ? "inline-block": "none")" title="Удалить из избранного">&nbsp;</span>
                }
            </div>
        </div>
    </div>
</div>